package org.wanho.servlet;

import com.alibaba.fastjson.JSON;
import org.wanho.util.ResponseResult;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Author：汤小洋
 * Date：2023-04-28 16:03
 * Description：<描述>
 */
@WebServlet("/world")
public class WorldServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        System.out.println(username+"------"+password);

        resp.setContentType("application/json;charset=utf8");
        PrintWriter out = resp.getWriter();

        out.print(JSON.toJSONString(ResponseResult.success()));
        out.close();
    }
}
